#ifndef __CHANNEL_HPP__
#define __CHANNEL_HPP__

#include <iostream>
#include <unistd.h>

// #include 
class Channel{
public:
    Channel(int fd, pid_t id):_fd(fd),_id(id)
    {
        _name = "Channel-"+ std::to_string(_fd) + "-pid:" + std::to_string(_id);
    }
    std::string Name(){
        return _name;
    }

    void Send(int cmd){
        ::write(_fd, &cmd, sizeof(cmd));
    }
    void Close(){
        ::close(_fd);
    }
    pid_t Id(){ return _id; }
    ~Channel()
    {

    }
private:
    int _fd;
    pid_t _id;
    std::string _name;
};

#endif

#pragma once
